package com.zyp.iterator;

import java.util.List;

/**
 * 
 *	模拟Iterator接口
 */
public interface MyIterator {

	/**
	 * 
	 * @return
	 */
	public boolean hasNext();
	
	
	public Object next();
	
}


class MyConcreateIterator implements MyIterator{

	private List<Object> list;
	private int cursor=0;//当前游标的位置
	
	public MyConcreateIterator(List<Object> list){
		this.list=list;
	}
	
	@Override
	public boolean hasNext() {
		return !(cursor==list.size());
	}

	@Override
	public Object next() {
		Object o=null;
		if(hasNext()){
			o=list.get(cursor++);
		}
		return o;
	}

}